package com.tnsw.noxnox;

import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;

public class ViewPagerInterceptable extends ViewPager {

	private String TAG = "ViewPagerInterceltable";
	protected Fragment signupActivity;
	private boolean mDisablePaging = false;
	
	public ViewPagerInterceptable(Context context) {
		super(context);
		Log.d(TAG, "Constructor()");

	}

	public ViewPagerInterceptable(Context context, AttributeSet attrs) {
		super(context, attrs);
		Log.d(TAG, "Constructor(context, attrs)");
		
		Log.d(TAG, "signupFragment is created");
	}
	
	public void setDisablePaging(boolean b) {
		this.mDisablePaging = b;
	}
	
	public boolean getDisablePaging() {
		return(this.mDisablePaging);
	}
	
	@Override
	public boolean onInterceptTouchEvent(MotionEvent arg0) {
	    // Don't allow swiping to switch between pages if we disabled it
	    if (mDisablePaging) {
	       return false;
	    }

	    // Otherwise, do the normal behavior 
	    return super.onInterceptTouchEvent(arg0);
	}
}
